package com.xjh.t.vo;

import cn.hutool.json.JSONObject;
import com.xjh.t.domain.OrderInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
public class OrderInfoVo extends OrderInfo {

    private static final long serialVersionUID = 1L;

    private Integer page=1;
    private Integer limit=14;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    private String orderAccount;
    private String orderCompany;

    private String customer;

    private String outputCenter;

    private String customerPhone;

    private String customAddress;

    private float amount;

    public void parseOrderInfo()
    {
        try {
            JSONObject json = new JSONObject(this.getOrText());
            this.setCustomer(json.getStr("consignee"));
            this.setCustomAddress(json.getStr("address"));
            this.setCustomerPhone(json.getStr("tel"));
            this.setOutputCenter(json.getStr("manufacturer_name"));
            this.setAmount(json.getFloat("money_paidStr"));
        }
        catch (Exception e)
        {

        }

    }

}
